#include "lightdialog.h"
#include "ui_lightdialog.h"

LightDialog::LightDialog(QWidget *parent) : QDialog(parent), ui(new Ui::LightDialog)
{
    ui->setupUi(this);
    connect(ui->buttonBox, SIGNAL(accepted()), SLOT(handleOKClick()));
    connect(ui->fieldX, SIGNAL(valueChanged(double)), SLOT(handleValueChange()));
    connect(ui->fieldY, SIGNAL(valueChanged(double)), SLOT(handleValueChange()));
    connect(ui->fieldZ, SIGNAL(valueChanged(double)), SLOT(handleValueChange()));
    connect(ui->buttonBox, SIGNAL(rejected()), SLOT(close()));
}

LightDialog::~LightDialog()
{
    delete ui;
}

void LightDialog::handleOKClick() {
    close();
}

void LightDialog::handleValueChange() {
    emit(updateLightPos(ui->fieldX->value(),
                        ui->fieldY->value(),
                        ui->fieldZ->value()));
}
